		
			var pos = 0;
			var maxPos = 0;

			function run(links)
			{
				spendenbox = window.open(links[pos],"spendenbox","width=800,height=600,left=1500,top=0");
				spendenbox.focus();
				if(pos >= maxPos)
				{
					pos = 0;
				} else {
					pos++;
				}
				if(counter >= maxPos)
				{
					stop();
					window.setTimeout('window.open("../views/thanks.html","spendenbox")',10000);
				}
				counter++;
			}
		
			function start()
			{
				links = new Array();
				tmpLinks = document.getElementsByName("spendenlink");
				for(i=0; i < tmpLinks.length; i++)
				{
					if(tmpLinks[i].className == "notHidden")
					{
						links.push(tmpLinks[i].href);
					}
				}
				maxPos = links.length - 1;
				if(maxPos >= 0)
				{
					document.getElementById("start").className = "hidden";
					document.getElementById("stop").className = "notHidden";
					document.getElementById("intervall").disabled = true;
					pos = getRandomPos(maxPos);
					counter = 0;
					intervall = document.getElementById("intervall").value;
					intervall = intervall * 1000;
					run(links);
					if(maxPos > 0)
					{
						aktiv = window.setInterval("run(links)",intervall);
					}
				}
			}
		
			function stop()
			{
				try
				{
					window.clearInterval(aktiv);
				} catch(e){}
				document.getElementById("stop").className = "hidden";
				document.getElementById("start").className = "notHidden";
				document.getElementById("intervall").disabled = false;
			} 
		
			function getRandomPos(max)
			{
				return Math.round(Math.random() * max);
			}
			
			function checkPenner(pennerId)
			{
				if(document.getElementById("meinPenner"+pennerId).checked)
				{
					disableSpendenlink(pennerId);
					setActiveDescription("descMeinPenner", pennerId);
					return;
				}
//				if(document.getElementById("aktiv"+pennerId).value == "false")
//				{
//					disableSpendenlink(pennerId);
//					setActiveDescription("descKeineSpenden", pennerId);
//					return;
//				}
				enableSpendenlink(pennerId);
				setActiveDescription("descSpenden", pennerId);
			}

			function enableSpendenlink(pennerId)
			{
				document.getElementById("spendenlink"+pennerId).className = "notHidden";
				document.getElementById("pennerName"+pennerId).className = "hidden";
			}

			function disableSpendenlink(pennerId)
			{
				document.getElementById("spendenlink"+pennerId).className = "hidden";
				document.getElementById("pennerName"+pennerId).className = "notHidden";
			}
			
			function setActiveDescription(desc, pennerId)
			{
				switch(desc)
				{
					case "descMeinPenner":
						document.getElementById("descSpenden"+pennerId).className = "hidden";
						document.getElementById("descKeineSpenden"+pennerId).className = "hidden";
						document.getElementById("descBecherVoll"+pennerId).className = "hidden";
						document.getElementById(desc+pennerId).className = "notHidden";
						break;
					case "descSpenden":
						document.getElementById("descMeinPenner"+pennerId).className = "hidden";
						document.getElementById("descKeineSpenden"+pennerId).className = "hidden";
						document.getElementById("descBecherVoll"+pennerId).className = "hidden";
						document.getElementById(desc+pennerId).className = "notHidden";
						break;
					case "descKeineSpenden":
						document.getElementById("descMeinPenner"+pennerId).className = "hidden";
						document.getElementById("descSpenden"+pennerId).className = "hidden";
						document.getElementById("descBecherVoll"+pennerId).className = "hidden";
						document.getElementById(desc+pennerId).className = "notHidden";
						break;
					case "descBecherVoll":
						document.getElementById("descMeinPenner"+pennerId).className = "hidden";
						document.getElementById("descSpenden"+pennerId).className = "hidden";
						document.getElementById("descKeineSpenden"+pennerId).className = "hidden";
						document.getElementById(desc+pennerId).className = "notHidden";
						break;
					default:
						document.getElementById("descMeinPenner"+pennerId).className = "hidden";
						document.getElementById("descSpenden"+pennerId).className = "hidden";
						document.getElementById("descKeineSpenden"+pennerId).className = "hidden";
						document.getElementById("descBecherVoll"+pennerId).className = "hidden";
						break;
				}
			}
			
